#!/bin/bash
createTunnel() {
  ssh -N -R 1234:localhost:22 192.168.0.250 &
  if [[ $? -eq 0 ]]; then
    echo Tunnel to jumpbox created successfully
  else
    echo An error occurred creating a tunnel to jumpbox. RC was $?
  fi
}
ps -ef|grep "ssh -N" | grep -v grep
if [[ $? -ne 0 ]]; then
  echo Creating new tunnel connection
  createTunnel
fi

